package com.zkt.practice.server.mapper;

import com.zkt.practice.server.entity.po.PracticeDetailPO;
import com.zkt.practice.server.entity.po.PracticeRankPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 赵开泰
 * @program jc-club
 * @date 2025/3/23
 * @description 练题详情mapper层
 **/

@Mapper
public interface PracticeDetailMapper {
	
	/**
	 * 获取正确答案数量
	 */
	int selectCorrectCount(@Param("practiceId") Long practiceId);
	
	/**
	 * 获取得分情况
	 */
	List<PracticeDetailPO> selectByPracticeId(@Param("practiceId") Long practiceId);
	
	/**
	 * 插入练题记录
	 */
	int insertSingle(PracticeDetailPO practiceDetailPO);
	
	/**
	 * 根据练习id，题目id，查询详情
	 */
	PracticeDetailPO selectDetail(@Param("practiceId") Long practiceId,
	                              @Param("subjectId") Long subjectId,
	                              @Param("loginId") String loginId);
	
	/**
	 * 更新练习详情
	 */
	int update(PracticeDetailPO practiceDetailPO);
	
	/**
	 * 获取答案情况
	 */
	PracticeDetailPO selectAnswer(@Param("practiceId") Long practiceId,@Param("subjectId") Long subjectId);
	
	/**
	 * 获取排行榜情况
	 */
	List<PracticeRankPO> getPracticeCount();
	
	/**
	 * 删除练习详情
	 */
	int deleteByPracticeId(Long practiceId);
	
}